Repository navigation
fix(cli): launch connect via localhost when server binds 0.0.0.0 - #1219
Merged
Merged
Conversation
…odel loads The global `_MTP_ACTIVE` flag (set via `set_mtp_active` before `mlx_lm.load()`) persists after model load completes. This caused three failure modes: 1. **Model switch**: Loading a non-MTP-compatible model after an MTP-enabled one left `_MTP_ACTIVE=True`. The patched `Model.__init__` on the new model then incorrectly attached an MTP head, crashing with missing mtp.* weights. 2. **SpecPrefill draft model (BatchedEngine)**: A target model with MTP enabled leaked the flag to the draft model load, causing the same crash. 3. **SpecPrefill draft model (VLMBatchedEngine)**: Same as (2) for VLM path. Changes: - `maybe_apply_pre_load_patches()`: reset `_MTP_ACTIVE=False` at function entry before any model-specific logic, so every load starts from a known state. - `BatchedEngine._load_draft()`: snapshot current flag, disable MTP, load draft, restore flag. - `VLMBatchedEngine._load_draft()`: same snapshot/restore guard. Closes the root cause behind "Native MTP is enabled for this model but the converted weights are missing the mtp.* tensors" errors when using SpecPrefill with a Qwen3.5 draft after an MTP-enabled model was previously loaded. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0.0.0.0 is a valid bind-all address but cannot be used as a connect address from the client side. When settings.json contains host=0.0.0.0 (e.g. after starting the server with --host 0.0.0.0), `omlx launch` fails with "oMLX server is not running at http://0.0.0.0:12345". Introduce `connect_host` which falls back to 127.0.0.1 whenever the resolved host is 0.0.0.0 (or empty), while keeping the original host value for display purposes. This also fixes downstream integrations (claude, codex, pi, etc.) which receive the host via launch(). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Owner
|
Thanks for catching this. The 0.0.0.0 to 127.0.0.1 fallback in launch_command is the right shape; the bind addr vs connect addr distinction matches what utils/network.py already does. Noticed the branch also carries the _MTP_ACTIVE leak fix (afe0bb2); the root cause analysis there is spot on, especially the draft-model path that bypasses maybe_apply_pre_load_patches. Merging. |
This was referenced May 13, 2026
jundot
added a commit
that referenced
this pull request
Jul 28, 2026
Port the text-model implementation from mlx-lm PR #1219, with oMLX runtime registration, model routing, and oQ integration. Source: ml-explore/mlx-lm#1219 Upstream-Commit: 96dd6fc2e0d2a1c43fcbd5b3c4be7dee640ad304
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
omlx launchfailing when the server is configured to bind to0.0.0.0.Problem
When
settings.jsoncontainshost: "0.0.0.0"(e.g. afteromlx serve --host 0.0.0.0),omlx launch claudefails with:0.0.0.0is a valid bind-all address but not a valid client-side connect address.Fix
Introduce
connect_hostinlaunch_command()which falls back to127.0.0.1whenever the resolved host is0.0.0.0(or empty). The originalhostvalue is preserved for display; only the actual HTTP connection URL and the downstream integrationlaunch()call use the corrected address.Test plan
omlx serve --host 0.0.0.0 --port 12345thenomlx launch claude→ connects successfullyomlx serve --host 127.0.0.1thenomlx launch claude→ still works (no regression)🤖 Generated with Claude Code